<template>
  <transition>
    <div class="container">
      <div class="c0">
        <div class="c00">
          <div class="r1">
            <div class="r1l" style="display: flex">巡查事件记录</div>
            <div class="r1r" @click="packBtn" v-if="state.isBreak">
              收起
              <!-- <img src="@/assets/images/shouq.png" /> -->
              <el-icon color="#fff"><ArrowDown /></el-icon>
            </div>
            <div class="r1r" @click="openBtn" v-if="!state.isBreak">
              展开
              <!-- <img src="@/assets/images/shouq.png" /> -->
              <el-icon color="#fff"><ArrowUp /></el-icon>
            </div>
          </div>
          <div class="nrSty" v-if="state.isBreak">
            <div class="gzxc">
              <div v-for="(item, index) in props.list" :key="index">
                <div class="itemSty" @click="pickBtn(item)">
                  <div class="wtbzSty">
                    <img
                      v-if="item.source == '智能上报'"
                      src="/images/znsb.png"
                      alt=""
                    />
                    <img v-else src="/images/rgsb.png" alt="" />
                    <div
                      style="
                        position: absolute;
                        top: 3px;
                        left: 12px;
                        font-size: 12px;
                        color: #fff;
                      "
                    >
                      {{ item.source }}
                    </div>
                  </div>
                  <div
                    :style="{
                      'text-align': 'right',
                      color:
                        item.eventClass == '重点'
                          ? '#FF7575'
                          : item.eventClass == '紧急'
                          ? '#FFBD00'
                          : '#6E8DFB',
                      'font-size': '12px',
                      height: item.eventClass ? '' : '20px',
                    }"
                  >
                    {{ item.eventClass }}
                  </div>
                  <div
                    style="
                      display: flex;
                      justify-content: space-between;
                      align-items: center;
                    "
                  >
                    <div class="itemTit">{{ item.eventType }}</div>
                    <div>{{ item.reportTime }}</div>
                  </div>
                  <div style="margin-top: 10px">{{ item.desc }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script setup>
const props = defineProps({
  list: Array,
  packZt1: Boolean,
});
watch(
  () => props.packZt1,
  (newval, oldval) => {
    if (newval) {
      state.isBreak = false;
    }
  }
);

const state = reactive({
  mychart: null,
  switch: 0,
  data: {},
  modelist: ["未完成 (12)", "已完成 (14)"],

  isPick: "1",
  isBreak: true,
});

const getData = () => {
  // useApi
  //   .post("/api/overview/equipment/channelCountAndOnlineRate")
  //   .then((res) => {
  //     let data = res.data || {};
  //     Object.assign(state.data, data);
  //     chart();
  //   });
};
const pickBtn = (item) => {
  console.log(item);
  state.isPick = item.id;
};

const emit = defineEmits(["packVal"]);
const packBtn = () => {
  state.isBreak = false;
  emit("packVal", state.isBreak);
};
const openBtn = () => {
  state.isBreak = true;
  emit("packVal", state.isBreak);
};
onMounted(() => {
  // getData();
});
</script>

<style scoped>
.container {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #fff;
}
.c0 {
  width: 300px;
  height: 100%;
  border-radius: 12px;
  background: #fff;
}
.c00 {
  height: calc(100% - 20px);

  border-radius: 8px;
  /* padding: 14px; */
}
.c01 {
  width: 22px;
  height: 100px;

  border-radius: 12px 0 0 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.r1 {
  line-height: 40px;
  height: 40px;
  display: flex;
  /* margin: 14px; */
  background: #2263bf;
  color: #ffffff;
  padding: 0 22px;
}
.nrSty {
  margin-top: 10px;
  /* padding: 0 0px 0 12px; */
  transition: all 0.5s;
}
.r1l {
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 14px;
  color: #ffffff;
}
.r1r {
  margin-left: auto;
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 12px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.r2 {
  height: 90px;
  display: flex;
}
.r21 {
  width: 222px;
  height: 90px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0px 2px 10px 0px rgba(201, 212, 230, 0.7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 18px;
}
.r21r {
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}
.r21t {
  line-height: 20px;
  font-size: 14px;
  color: #58627b;
}
.r21n {
  font-family: YouSheBiaoTiHei;
  font-size: 32px;
  color: #293555;
  line-height: 42px;
}
.r21w {
  margin-left: 10px;
  font-size: 14px;
  color: #142144;
  line-height: 20px;
}
.r22 {
  margin-left: 10px;
  width: 180px;
  height: 90px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0px 2px 10px 0px rgba(201, 212, 230, 0.7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 18px;
}
.r3 {
  height: calc(100% - 110px);
}
.cont2 {
  margin-top: 20px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 88px;
  width: 110px;
}
.c1 {
  width: 22px;
  height: 58px;
  background: linear-gradient(134deg, #e9effb 0%, #fbfcff 100%);
  box-shadow: 3px 3px 16px 0px rgba(159, 177, 206, 0.7),
    -4px -3px 10px 0px #ffffff;
  border: 1px solid #ffffff;
  border-radius: 12px 0 0 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.c2 {
  width: 88px;
  height: 88px;
  background: linear-gradient(134deg, #e9effb 0%, #fbfcff 100%);
  box-shadow: 3px 3px 16px 0px rgba(159, 177, 206, 0.7),
    -4px -3px 10px 0px #ffffff;
  border: 1px solid #ffffff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.imgbtn {
  cursor: pointer;
}
.c2t {
  font-size: 14px;
  color: #58627b;
}
.modelist {
  height: 100%;
  /* width: 342px; */
  background: #ffffff;
  box-shadow: 3px 3px 6px 0px #bdcde6,
    -4px -3px 4px 0px rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  margin: 20px 0 0;
  display: flex;
  flex-direction: row;
  margin: 0 16px;
  /* justify-content: space-between; */
}
.modes {
  width: 50%;
  height: 36px;
  cursor: pointer;
  /* border-radius: 6px; */
  display: flex; /* 使用 Flexbox 布局 */
  justify-content: center; /* 水平居中 */
  align-items: center;
}
.modetext {
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  font-size: 16px;
  color: #000000;
  line-height: 22px;
}

.activemodetext {
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  font-size: 16px;
  color: #fefefe;
  line-height: 22px;
}

.active {
  background: #6e8dfb;
}
/* 1.过渡动画 */
@keyframes axisX {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.v-enter-active {
  animation: axisX 0.5s;
}
.gzxc {
  margin-top: 16px;
  margin-bottom: 16px;
  /* padding-left: 26px; */
  height: 240px;
  overflow: auto;
}
.itemSty {
  font-size: 14px;
  background-color: #fff;
  margin: 15px 10px;
  padding: 12px;
  border-radius: 12px;
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 14px;
  color: #58627b;
  line-height: 20px;
  position: relative;
  background: rgba(142, 191, 255, 0.22);
}
.wtbzSty {
  position: absolute;
  top: -6px;
  left: 10px;
}
.itemTit {
  font-family: PingFangSC, PingFang SC;
  font-weight: 600;
  font-size: 14px;
  color: #293555;
  line-height: 20px;
  text-align: left;
  font-style: normal;
}
.itemSty_pick {
  font-size: 14px;
  line-height: 46px;
  background: rgba(110, 141, 251, 0.2);
  color: #6e8dfb;
  padding-left: 40px;
}
::-webkit-scrollbar-thumb {
  background: #d3e3fd;
  border-radius: 4px;
}
::-webkit-scrollbar {
  width: 8px;
  height: 100px;
}
</style>
